import request from '@/utils/request'

export function getPage(query) {
  return request({
    url: '/orderinfo/page',
    method: 'get',
    params: query
  })
}

export function getCount(query) {
  return request({
    url: '/orderinfo/count',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/orderinfo',
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: '/orderinfo/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/orderinfo/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/orderinfo',
    method: 'put',
    data: obj
  })
}

export function editPrice(obj) {
  return request({
    url: '/orderinfo/editPrice',
    method: 'put',
    data: obj
  })
}

export function orderCancel(id) {
  return request({
    url: '/orderinfo/cancel/' + id,
    method: 'put'
  })
}

export function takeGoods(id) {
  return request({
    url: '/orderinfo/takegoods/' + id,
    method: 'put'
  })
}

/**
 * 根据商品分类统计订单占比
 * @author drinvay
 * @date 2022/5/7
 */
 export function getOrderCount() {
  return request({
    url: '/orderinfo/ordercount',
    method: 'get'
  })
}

/**
 * 获取订单实时数据
 * @author drinvay
 * @date 2022/5/7
 */
export function getOrderTimeData() {
  return request({
    url: '/orderinfo/timedata',
    method: 'get'
  })
}

/**
 * 获取订单图表数据
 * @author drinvay
 * @date 2022/5/7
 */
export function getChartData() {
  return request({
    url: '/orderinfo/chartdata',
    method: 'get'
  })
}